import React, { Component } from 'react';
import '../../index.css'
class Search extends Component {
  state={
    title:''
  }

  // 搜索框
  Changetitle = (e)=>{
    this.setState({
      title:e.target.value
    })
  }

  // 查询
  baidu =(e)=>{
    // console.log(e);
    this.props.search(this.state.title)
    this.setState({
      title:''
    })
  }

  render() { 
    return (  <div className='inputbtn'>
    <input type="text" value={this.state.title} className='input inputs' onChange={this.Changetitle}/>
    <button className='button' onClick={()=>this.baidu(this.state.title)}>百度一下</button>
  </div> );
  }
}
 
export default Search;